import { error } from '@/components/Message'
import axios from 'axios'

const instance = axios.create({
  timeout: 5000
})

instance.interceptors.request.use((config) => {
  return config
})

instance.interceptors.response.use((resp) => {
  if (resp.data.code !== 0) {
    error(resp.data.msg, 1500)
    return null
  }
  return resp.data
})

export default instance
